package com.dianban.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class InterceptorConfiguration extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new ApiInterceptor()).addPathPatterns("/api/**");

        registry.addInterceptor(new ApiUserInterceptor())
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/shopUser/login")
                .excludePathPatterns("/api/user/login")
                .excludePathPatterns("/api/syncShoproOrder/syncOrder")
                .excludePathPatterns("/api/syncStoreOrder/*")
                .excludePathPatterns("/api/user/canBecomeStation")
                .excludePathPatterns("/api/config/**")
                .excludePathPatterns("/api/facePayDevice/**")
                .excludePathPatterns("/api/nengliang/**/**")
                .excludePathPatterns("/api/shaliangjie/**/**");

        registry.addInterceptor(new ApiAuthInterceptor())
                .addPathPatterns("/api/nengliang/card/**")
                .addPathPatterns("/api/nengliang/h5user/**")
                .addPathPatterns("/api/nengliang/store/**")
                .addPathPatterns("/api/nengliang/area/**")
                .addPathPatterns("/api/nengliang/address/**")
                .addPathPatterns("/api/nengliang/goods/**")
                .addPathPatterns("/api/nengliang/order/**")
                .addPathPatterns("/api/nengliang/guide/**")
                .addPathPatterns("/api/nengliang/manager/**")
                .addPathPatterns("/api/nengliang/map/**")
                .addPathPatterns("/api/nengliang/account/**")
                .addPathPatterns("/api/nengliang/transfer/**")
                .addPathPatterns("/api/nengliang/commissionLog/**")
                .addPathPatterns("/api/nengliang/commissionVerify/**")
                .addPathPatterns("/api/nengliang/consumeLog/**")
                .addPathPatterns("/api/nengliang/facePayStoreOrderShare/list")
                .addPathPatterns("/api/nengliang/facePayStoreOrderShare/share")
                .addPathPatterns("/api/nengliang/facePayStoreOrderShare/verify");
    }

}
